package level.editor;

import core.Constants;
import level.editor.detail.DetailModule;
import level.editor.main.LevelModule;
import level.editor.mediator.Mediator;
import level.editor.menu.MenuModule;
import level.editor.state.StateModule;
import level.editor.tool.ToolModule;
import level.editor.window.Window;

/*
 * Entry point for application. Initiates window and the main modules.
 * Responsible for cleaning up on program exit.
 */

public class Editor
{
	private final static String TITLE = Constants.VERSION;

	public static void main(String[] args)
	{
		init();
	}

	private static void init()
	{
		Window window = new Window(TITLE);
		init(window);
	}

	private static void init(Window window)
	{
		/*
		 * MODULES TO ADD: -MAP -TOOLBOX -ADVANCED
		 */
		Mediator mediator = new Mediator();
		
		MenuModule menu = new MenuModule(mediator);
		menu.establishView(window);
		
		LevelModule level = new LevelModule(mediator);
		level.establishView(window);

		StateModule state = new StateModule(mediator);
		state.init(window);
		
		ToolModule tool = new ToolModule(mediator);
		tool.establishView(window);
		
		DetailModule detail = new DetailModule(mediator);
		detail.establishView(window);
		
		
		window.revalidate();
	}
}
